package fr.polichouz.geotracer.shared;

import java.io.Serializable;

/**
 * A location (lattitude, longitude)
 * 
 * @author Yoyo
 */
public class SimpleLocation implements Serializable {

    /** Serial number for serialisation.  */
    private static final long serialVersionUID = 1L;

    /** Lattitude */
    private double lattitude;
    
    /** Lontitude */
    private double longitude;

    /**
     * Initialise a new simple location.
     * 
     * @param lattitude
     * @param longitude
     */
    public SimpleLocation(double lattitude, double longitude) {
	this.lattitude = lattitude;
	this.longitude = longitude;
    }

    public Double getLattitude() {
        return lattitude;
    }

    public Double getLongitude() {
        return longitude;
    }

    @Override
    public boolean equals(Object o) {
	return o instanceof SimpleLocation && 
		((SimpleLocation)o).toString().equals(toString());
    }

    @Override
    public int hashCode() {
	return toString().hashCode();
    }

    @Override
    public String toString() {
	StringBuilder builder = new StringBuilder();
	builder.append("SimpleLocation [lattitude=");
	builder.append(lattitude);
	builder.append(", longitude=");
	builder.append(longitude);
	builder.append("]");
	return builder.toString();
    }
}
